package cn.wolfcode.wolf2w.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.*;

/**
 * 目的地(行政地区：国家/省份/城市)
 */
@Setter
@Getter
@Document("owner")
public class Owner extends BaseDomain {
    private String nickname;        //名称
    private String title;  //英文名

    private String consult; //上级目的地
    private String coverUrl;  //上级目的名
    private int sequence;  //上级目的名
    private Date time;  //上级目的名

    private String info;    //简介
//    private String[] userIds;  //层面：国家1 省份2 城市3
    private  int state;
    private  int care;
    private  int countNum;
    private  int mycare;
    private  int gender;
    private  String city;
    private  String headImgUrl;



    //子地区
    @Transient  //添加时, 忽略该字段, 不要讲这个字段添加到mongodb数据集合中(表)
    private List<UserInfo> userInfos = new ArrayList<>();

    public String getJsonString(){
        Map<String,Object> map = new HashMap<>();
        map.put("id", super.getId());
        map.put("info", this.info);

        return JSON.toJSONString(map);
    }
}
